<!DOCTYPE html>
<html lang="en">


{include file="Public/head"}

<body data-type="widgets">
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

    {include file='Public:header'}
    {include file='Public:menu2'}



    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title  am-cf">活动</div>
                        </div>
                        <div class="widget-body  am-fr">

                            <div class="am-u-sm-12 am-u-md-6 am-u-lg-6" >
                                <div class="am-form-group" >
                                    <div class="am-btn-toolbar" >
                                        <div class="am-btn-group am-btn-group-xs" >
                                            <a href="{:Url('add')}" class="am-btn am-btn-default am-btn-success" ><span class="am-icon-plus" ></span> 新增</a>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="am-u-sm-10">
                                <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black " id="example-r">
                                    <thead>
                                    <tr>
                                        <th>活动id</th>
                                        <th>活动名称</th>
                                        <th>活动描述</th>
                                        <th>禁用/启用</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {foreach name="data" key="key" item="value"}
                                    <tr class="gradeX">
                                        <td>{$value.id}</td>
                                        <td>{$value.title}</td>
                                        <td>{$value.data}</td>
                                        <td>{if $value.display==0}可用{else}已禁用{/if}</td>
                                        <td>
                                            <div class="tpl-table-black-operation">
                                                <a href="{:Url('add')}?id={$value.id}">
                                                    <i class="am-icon-pencil"></i> 编辑
                                                </a>
                                                <a onclick="del_button({$value.id});" href="javascript:void(0);" href="javascript:;" class="tpl-table-black-operation-del">
                                                    <i class="am-icon-trash"></i> 删除
                                                </a>
                                            </div>
                                        </td>
                                    </tr>
                                    {/foreach}
                                    <!-- more data -->
                                    </tbody>
                                </table>
                            </div>
                            <div class="am-u-lg-10 am-cf">

                                <div class="am-fr">
                                    <ul class="am-pagination tpl-pagination">
                                        {$data->render()}
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

</body>
{include file='Public:script'}

<script>

    // 删除按钮
    function del_button(id, className) {
        layer.confirm("确定删除？", {btn: ["确定","取消"], shade: 0.5}, function(){
            // 删除权限组
            $.post("{:url('del')}", {id: id}, function(res) {
                if (res.code != 200) {
                    layer.msg(res.msg, {shade: 0.5, time: 1000, icon: 2});
                    return false;
                }

                layer.msg(res.msg, {shade: 0.5, time: 1000, icon: 1}, function() {
                    layer.closeAll('page');
                    location.reload();
                });
            });
        }, function () {});
    }


</script>
</html>